(function($){
  var engine;
  $.search = function(words, selector, forceUpdate) {
    if (!selector) {
      selector = "p";
    }
    if (!engine || forceUpdate) {
      engine = new jGuery.jGuery();
    }
    engine.updateIndexByTag(selector);
    //engine.updateIndex($(selector));
    var ids = engine.getMatchedIds(words);
    if (!ids) return $([]);
    return $(selector).filter(function (index) {
      length = ids.length;
      for (var i = 0; i < length; i++) {
        if (index == ids[i]) {
          return true;
        }
      }
      return false;
    });
  };
})(jQuery);
